Dynomotion

Group: DynoMotion Message: 14726 From: Moray Cuthill Date: 5/11/2017
Subject: Servo runaway during tuning?
Hi,

I'm now onto tuning my spindle servo, but am having a runaway issue while trying to tune it using the step response screen.
If I command a step move of 100000, everything works nicely, but if I double the move size, the output seems to stick and the spindle continues to run at full output. This is using 3.34e, as I've not updated the machine computer yet.

I've attached two files with the step response results, along with a file containing the channel settings.
What's causing the runaway?
And any suggestions for improving the servo tuning?
So far was just a quick change of settings to get reasonable performance.

Thanks,
Moray

Virus-free. www.avast.com
  @@attachment@@
Group: DynoMotion Message: 14729 From: Tom Kerekes Date: 5/11/2017
Subject: Re: Servo runaway during tuning? [3 Attachments]

Hi Moray,

Looks like the DAC value is wrapping around causing the runaway.

We just added this topic.  See:

http://www.dynomotion.com/wiki/index.php?title=Kanalog_Hardware_Info#Max_Output_For_DACs

Note also a reasonable Max Following Error would avoid a runaway in such cases and instead fault and disable instead.

Regarding motion profile tuning:

Looks like you are fully Jerk Limited.  You might read this:
http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk

Regarding Servo tuning:

A small amount of I Gain should reduce following errors.  But I'm not sure you care for a Spindle Axis.  D Gain is probably too low to do much of anything.  Higher D gain will provide damping and possibly allow higher P and I gains.  If higher D Gain causes spikes in the output a 2nd Order Low Pass filter (ie 1000Hz Q=1.4) can be added in the Last Filter.

HTH
Regards
TK




On 5/11/2017 5:09 AM, Moray Cuthill moray.cuthill@... [DynoMotion] wrote:
 
Hi,

I'm now onto tuning my spindle servo, but am having a runaway issue while trying to tune it using the step response screen.
If I command a step move of 100000, everything works nicely, but if I double the move size, the output seems to stick and the spindle continues to run at full output. This is using 3.34e, as I've not updated the machine computer yet.

I've attached two files with the step response results, along with a file containing the channel settings.
What's causing the runaway?
And any suggestions for improving the servo tuning?
So far was just a quick change of settings to get reasonable performance.

Thanks,
Moray

Virus-free. www.avast.com

Group: DynoMotion Message: 14731 From: Moray Cuthill Date: 5/11/2017
Subject: Re: Servo runaway during tuning?
Hi Tom,

the wraparound makes sense. I thought it would be something stupid that I'd done. I remembered the 2048 bit, but forgot that it includes zero.
I'll reduce max following error once I get tuning sorted. I just left it high as since it's the spindle, a runaway wouldn't cause a problem during setup.

I did have Jerk set at double what it currently is, but things didn't sound very happy speeding up/slowing down that fast. I'm probably going to reduce acceleration as well, as although the servo can handle it perfectly well, I don't think I want to put that much force through the toothed drive belt, especially if a heavy tool is in.
And having just looked at the figures in the file I sent, I'm sure I never had acceleration that high. I'm sure it was at 4e+06, and jerk at 2e+07. I've maybe copied those settings from my init file, and not the latest I had set in KMotion.

Talking of the motion profile, it's got me thinking about rigid tapping.
I know that the Z-axis normally gets slaved the spindle, however what happens if the spindle stops and reverses faster than the Z can stop and reverse?

I'll work on the servo tuning a bit more, as that was just an initial quick tune to get going, but then I hit the runaway problem. I think for the spindle I'll be happy with following error under 100 counts. The current ~1200 following error equates to 43 degree of rotation (10'000 count per rev encoder). 100 would be 3.6 degrees.

Would it be possible to get a PID tuning guide added to the wiki?
I remember having one of your posts from a good few years ago to reference when I setup my lathe, but I can't find it now.

Thanks,
Moray

On Thu, May 11, 2017 at 6:22 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi Moray,

Looks like the DAC value is wrapping around causing the runaway.

We just added this topic.  See:

http://www.dynomotion.com/ wiki/index.php?title=Kanalog_ Hardware_Info#Max_Output_For_ DACs

Note also a reasonable Max Following Error would avoid a runaway in such cases and instead fault and disable instead.

Regarding motion profile tuning:

Looks like you are fully Jerk Limited.  You might read this:
http://www.dynomotion.com/ wiki/index.php?title=Main_ Page#Velocity.2C_Acceleration. 2C_and_Jerk

Regarding Servo tuning:

A small amount of I Gain should reduce following errors.  But I'm not sure you care for a Spindle Axis.  D Gain is probably too low to do much of anything.  Higher D gain will provide damping and possibly allow higher P and I gains.  If higher D Gain causes spikes in the output a 2nd Order Low Pass filter (ie 1000Hz Q=1.4) can be added in the Last Filter.

HTH
Regards
TK





On 5/11/2017 5:09 AM, Moray Cuthill moray.cuthill@... [DynoMotion] wrote:
 
Hi,

I'm now onto tuning my spindle servo, but am having a runaway issue while trying to tune it using the step response screen.
If I command a step move of 100000, everything works nicely, but if I double the move size, the output seems to stick and the spindle continues to run at full output. This is using 3.34e, as I've not updated the machine computer yet.

I've attached two files with the step response results, along with a file containing the channel settings.
What's causing the runaway?
And any suggestions for improving the servo tuning?
So far was just a quick change of settings to get reasonable performance.

Thanks,
Moray

Virus-free. www.avast.com


Group: DynoMotion Message: 14749 From: Moray Cuthill Date: 5/14/2017
Subject: Re: Servo runaway during tuning?
Hi,

I'm looking for a bit more advise with the tuning.
I've got things pretty good, however I suspect it's maybe a bit too on a knife edge in terms of stability.

I had to add a bit Feed Forward V, as no matter what combination I tried, the best following error I got during full acceleration was around 600 counts. During the jerk limited period, the error was sub 100.
After adding the feed forward, the output was a bit noisy, so as per your suggestion I added the 2nd order low pass 1000Hz Q1.4 filter, and the output smoothed out, and greatly improved the following error.

However, due to needing to enable/disable the spindle, I've noticed a problem.
If I enable the drive and immediately enable the channel, I get a violent oscillation, which does not settle down. I'm guessing this is due to the servo loop maxing out due to the drive taking a short period to actually enable, as if I program in a 0.3 second delay between activating the drive, and enabling the axis, everything enables smoothly.

Leaving the delay in, is not a problem, however could this instability lead to problems during use?
I've reduced the max following error to 1000, so the axis disables instead of oscillating violently, however could it be a problem under load?

I'm running the servo in speed mode.

Basic axis settings are now -
 ch7->Vel=500000;
 ch7->Accel=2000000;
 ch7->Jerk=3e+07;
 ch7->P=1.7;
 ch7->I=0.012;
 ch7->D=35;
 ch7->FFAccel=0;
 ch7->FFVel=0.003;
 ch7->MaxI=2047;
 ch7->MaxErr=2047;
 ch7->MaxOutput=2047;

But I've attached my init file, if you want to look at the full settings.

One other thing, even though the Velocity is set to 500'000, which is 3000rpm, I can command higher speeds in KMotionCNC, and the spindle will run at higher speeds. Is there any way to limit max speed in KMotionCNC, or do I have to do it in the spindle control C code?

Thanks,
Moray

On Thu, May 11, 2017 at 6:22 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi Moray,

Looks like the DAC value is wrapping around causing the runaway.

We just added this topic.  See:

http://www.dynomotion.com/ wiki/index.php?title=Kanalog_ Hardware_Info#Max_Output_For_ DACs

Note also a reasonable Max Following Error would avoid a runaway in such cases and instead fault and disable instead.

Regarding motion profile tuning:

Looks like you are fully Jerk Limited.  You might read this:
http://www.dynomotion.com/ wiki/index.php?title=Main_ Page#Velocity.2C_Acceleration. 2C_and_Jerk

Regarding Servo tuning:

A small amount of I Gain should reduce following errors.  But I'm not sure you care for a Spindle Axis.  D Gain is probably too low to do much of anything.  Higher D gain will provide damping and possibly allow higher P and I gains.  If higher D Gain causes spikes in the output a 2nd Order Low Pass filter (ie 1000Hz Q=1.4) can be added in the Last Filter.

HTH
Regards
TK





On 5/11/2017 5:09 AM, Moray Cuthill moray.cuthill@... [DynoMotion] wrote:
 
Hi,

I'm now onto tuning my spindle servo, but am having a runaway issue while trying to tune it using the step response screen.
If I command a step move of 100000, everything works nicely, but if I double the move size, the output seems to stick and the spindle continues to run at full output. This is using 3.34e, as I've not updated the machine computer yet.

I've attached two files with the step response results, along with a file containing the channel settings.
What's causing the runaway?
And any suggestions for improving the servo tuning?
So far was just a quick change of settings to get reasonable performance.

Thanks,
Moray

Virus-free. www.avast.com


  @@attachment@@
Group: DynoMotion Message: 14750 From: Tom Kerekes Date: 5/14/2017
Subject: Re: Servo runaway during tuning? [2 Attachments]

Hi Moray,

Its best to get the best closed loop performance without resorting to open loop feedforward as closed loop will tend to compensate when things change such as friction and cutting forces.

I think your Max Limit Integrator is too low.  I often make the same mistake and forget to compensate for the effect of the D Gain.  Please see this article:

http://www.dynomotion.com/wiki/index.php?title=Main_Page#I_Gain.2FMax_Limit_Integrator

Regarding Enabling/Disabling and oscillation: Its good to have the tuning stable enough that they system never goes unstable regardless of the amount of shock it gets.  Max Limit Error might possibly help.  Yours seems unnecessarily high.  You might test with doing a "Step".  I don't often recommend testing "Step" as it results in sudden large error possibly saturating the output that would not normally occur.  But in this case it is exactly what you might be wanting to test and understand.  Lower gains might make the system stable enough to handle it.  I don't understand your need for small following errors with a Spindle Axis.  But the shock situation should be avoided if possible.

You may be able to get better performance by Bode Plot Analysis and using a Lead/Lag filter instead of D Gain.

HTH

Regards

TK


On 5/14/2017 2:36 PM, Moray Cuthill moray.cuthill@... [DynoMotion] wrote:
 
Hi,

I'm looking for a bit more advise with the tuning.
I've got things pretty good, however I suspect it's maybe a bit too on a knife edge in terms of stability.

I had to add a bit Feed Forward V, as no matter what combination I tried, the best following error I got during full acceleration was around 600 counts. During the jerk limited period, the error was sub 100.
After adding the feed forward, the output was a bit noisy, so as per your suggestion I added the 2nd order low pass 1000Hz Q1.4 filter, and the output smoothed out, and greatly improved the following error.

However, due to needing to enable/disable the spindle, I've noticed a problem.
If I enable the drive and immediately enable the channel, I get a violent oscillation, which does not settle down. I'm guessing this is due to the servo loop maxing out due to the drive taking a short period to actually enable, as if I program in a 0.3 second delay between activating the drive, and enabling the axis, everything enables smoothly.

Leaving the delay in, is not a problem, however could this instability lead to problems during use?
I've reduced the max following error to 1000, so the axis disables instead of oscillating violently, however could it be a problem under load?

I'm running the servo in speed mode.

Basic axis settings are now -
 ch7->Vel=500000;
 ch7->Accel=2000000;
 ch7->Jerk=3e+07;
 ch7->P=1.7;
 ch7->I=0.012;
 ch7->D=35;
 ch7->FFAccel=0;
 ch7->FFVel=0.003;
 ch7->MaxI=2047;
 ch7->MaxErr=2047;
 ch7->MaxOutput=2047;

But I've attached my init file, if you want to look at the full settings.

One other thing, even though the Velocity is set to 500'000, which is 3000rpm, I can command higher speeds in KMotionCNC, and the spindle will run at higher speeds. Is there any way to limit max speed in KMotionCNC, or do I have to do it in the spindle control C code?

Thanks,
Moray

On Thu, May 11, 2017 at 6:22 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi Moray,

Looks like the DAC value is wrapping around causing the runaway.

We just added this topic.  See:

http://www.dynomotion.com/ wiki/index.php?title=Kanalog_ Hardware_Info#Max_Output_For_ DACs

Note also a reasonable Max Following Error would avoid a runaway in such cases and instead fault and disable instead.

Regarding motion profile tuning:

Looks like you are fully Jerk Limited.  You might read this:
http://www.dynomotion.com/ wiki/index.php?title=Main_ Page#Velocity.2C_Acceleration. 2C_and_Jerk

Regarding Servo tuning:

A small amount of I Gain should reduce following errors.  But I'm not sure you care for a Spindle Axis.  D Gain is probably too low to do much of anything.  Higher D gain will provide damping and possibly allow higher P and I gains.  If higher D Gain causes spikes in the output a 2nd Order Low Pass filter (ie 1000Hz Q=1.4) can be added in the Last Filter.

HTH
Regards
TK





On 5/11/2017 5:09 AM, Moray Cuthill moray.cuthill@... [DynoMotion] wrote:
 
Hi,

I'm now onto tuning my spindle servo, but am having a runaway issue while trying to tune it using the step response screen.
If I command a step move of 100000, everything works nicely, but if I double the move size, the output seems to stick and the spindle continues to run at full output. This is using 3.34e, as I've not updated the machine computer yet.

I've attached two files with the step response results, along with a file containing the channel settings.
What's causing the runaway?
And any suggestions for improving the servo tuning?
So far was just a quick change of settings to get reasonable performance.

Thanks,
Moray

Virus-free. www.avast.com



Group: DynoMotion Message: 14791 From: Moray Cuthill Date: 5/19/2017
Subject: Re: Servo runaway during tuning?
Hi Tom,

a bit of an update with this, as I finally got some time to have another try with the tuning.
I altered the velocity loop feed back bandwidth in the servo drive, which helped reduce the output dithering needed from the Kanalog to maintain position. Too fast and the motor starter to audibly squeal, so I dropped it back about 20%, which is around double what it was.

Then after trying various extremes of settings, reducing P significantly, increasing I slightly and D quite a bit, while limiting I to 200, was the only way I could eliminate the unstable oscillations. However this led to an increase in following error, which was consistent at ~800 during large moves. This was the best I could achieve while maintaining good stability.

If I increased I, or the I limit, I could reduce following error to consistently below 200 during moves, however any shock would result in everything going unstable again.

Having spoken to the servo supplier in the past, I suspect part of the problem trying to get a good tune, is it's a medium inertia servo with very little load. So it's going to be inherently unstable, as it's not got much load attached to help stabilise things.

As it stands any shock results in a bit oscillation as everything settles to a standstill, which looking at the resultant graph from a 4000 step, takes about 0.2-0.3 of a second to settle. It's not perfect, but I think that's perfectly acceptable for a spindle. There probably also the problem that due to the spindle using an older toothed belt design, which is not zero backlash, there is some noticeable play when I try turning the spindle by hand with the servo stationary.

I have re-added some Feed Forward, which has reduced the following error to sub 20, but I'll wait to get some real world testing done, as I may just remove that, because as you say, a spindle does not have to be that accurate.

Thanks,
Moray



On Mon, May 15, 2017 at 1:45 AM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi Moray,

Its best to get the best closed loop performance without resorting to open loop feedforward as closed loop will tend to compensate when things change such as friction and cutting forces.

I think your Max Limit Integrator is too low.  I often make the same mistake and forget to compensate for the effect of the D Gain.  Please see this article:

http://www.dynomotion.com/ wiki/index.php?title=Main_ Page#I_Gain.2FMax_Limit_ Integrator

Regarding Enabling/Disabling and oscillation: Its good to have the tuning stable enough that they system never goes unstable regardless of the amount of shock it gets.  Max Limit Error might possibly help.  Yours seems unnecessarily high.  You might test with doing a "Step".  I don't often recommend testing "Step" as it results in sudden large error possibly saturating the output that would not normally occur.  But in this case it is exactly what you might be wanting to test and understand.  Lower gains might make the system stable enough to handle it.  I don't understand your need for small following errors with a Spindle Axis.  But the shock situation should be avoided if possible.

You may be able to get better performance by Bode Plot Analysis and using a Lead/Lag filter instead of D Gain.

HTH

Regards

TK


On 5/14/2017 2:36 PM, Moray Cuthill moray.cuthill@... [DynoMotion] wrote:
 
Hi,

I'm looking for a bit more advise with the tuning.
I've got things pretty good, however I suspect it's maybe a bit too on a knife edge in terms of stability.

I had to add a bit Feed Forward V, as no matter what combination I tried, the best following error I got during full acceleration was around 600 counts. During the jerk limited period, the error was sub 100.
After adding the feed forward, the output was a bit noisy, so as per your suggestion I added the 2nd order low pass 1000Hz Q1.4 filter, and the output smoothed out, and greatly improved the following error.

However, due to needing to enable/disable the spindle, I've noticed a problem.
If I enable the drive and immediately enable the channel, I get a violent oscillation, which does not settle down. I'm guessing this is due to the servo loop maxing out due to the drive taking a short period to actually enable, as if I program in a 0.3 second delay between activating the drive, and enabling the axis, everything enables smoothly.

Leaving the delay in, is not a problem, however could this instability lead to problems during use?
I've reduced the max following error to 1000, so the axis disables instead of oscillating violently, however could it be a problem under load?

I'm running the servo in speed mode.

Basic axis settings are now -
 ch7->Vel=500000;
 ch7->Accel=2000000;
 ch7->Jerk=3e+07;
 ch7->P=1.7;
 ch7->I=0.012;
 ch7->D=35;
 ch7->FFAccel=0;
 ch7->FFVel=0.003;
 ch7->MaxI=2047;
 ch7->MaxErr=2047;
 ch7->MaxOutput=2047;

But I've attached my init file, if you want to look at the full settings.

One other thing, even though the Velocity is set to 500'000, which is 3000rpm, I can command higher speeds in KMotionCNC, and the spindle will run at higher speeds. Is there any way to limit max speed in KMotionCNC, or do I have to do it in the spindle control C code?

Thanks,
Moray

On Thu, May 11, 2017 at 6:22 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi Moray,

Looks like the DAC value is wrapping around causing the runaway.

We just added this topic.  See:

http://www.dynomotion.com/wiki /index.php?title=Kanalog_Hardw are_Info#Max_Output_For_DACs

Note also a reasonable Max Following Error would avoid a runaway in such cases and instead fault and disable instead.

Regarding motion profile tuning:

Looks like you are fully Jerk Limited.  You might read this:
http://www.dynomotion.com/wiki /index.php?title=Main_Page# Velocity.2C_Acceleration.2C_ and_Jerk

Regarding Servo tuning:

A small amount of I Gain should reduce following errors.  But I'm not sure you care for a Spindle Axis.  D Gain is probably too low to do much of anything.  Higher D gain will provide damping and possibly allow higher P and I gains.  If higher D Gain causes spikes in the output a 2nd Order Low Pass filter (ie 1000Hz Q=1.4) can be added in the Last Filter.

HTH
Regards
TK





On 5/11/2017 5:09 AM, Moray Cuthill moray.cuthill@... [DynoMotion] wrote:
 
Hi,

I'm now onto tuning my spindle servo, but am having a runaway issue while trying to tune it using the step response screen.
If I command a step move of 100000, everything works nicely, but if I double the move size, the output seems to stick and the spindle continues to run at full output. This is using 3.34e, as I've not updated the machine computer yet.

I've attached two files with the step response results, along with a file containing the channel settings.
What's causing the runaway?
And any suggestions for improving the servo tuning?
So far was just a quick change of settings to get reasonable performance.

Thanks,
Moray

Virus-free. www.avast.com